package uit.net.web;

import org.apache.log4j.Logger;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import uit.net.web.dto.TestJson;

@Controller
public class HomeController {
    
    private static final Logger LOGGER=Logger.getLogger(HomeController.class);
    
    public HomeController()
    {
        LOGGER.info("HomeController Construction 123");
    }
    
    @RequestMapping(value="/home",produces = "text/html", method = RequestMethod.GET)
    public String showHomePage()
    {
        LOGGER.info("HomeController Construction index 456");
        return "home/index";
    }
    
    @RequestMapping(method=RequestMethod.GET, value="/rest", headers={"Accept=application/json"})
    public @ResponseBody TestJson testJson()
    {
        TestJson abc=new TestJson();
        abc.setId("8888");
        abc.setName("ninh");
        return abc;
    }

}
